<?php
//游客信息和认证类
class Controller_WWW_Customize extends Controller_WWW_Template
{

    public function __construct ($req, $res)
    {
        $this->template = "smarty:www/customize/index";
        parent::__construct($req, $res);
    }

    public function action_index(){
        $this->action_customized();
    }

    public function action_customized(){
        $post = $this->request->post();

        if(empty($post)){
            $this->template->set_filename("smarty:www/customize/index");
        }else{
//            var_dump($post);
            $data['tripTime'] = $post['year'].'/'.$post['month'].'/'.$post['day'];
            $data['tripLength'] = $post['dayLength'];
            $data['intro'] = $post['desc'];
            $data['status'] = 1;
            $data['created'] = time();
            $data['userName'] = Arr::get($post,'userName');
            $data['gender'] = Arr::get($post,'gender','m') == 'm' ? '男' : '女' ;
            $data['mobile'] = Arr::get($post,'mobile');
            $id = User_Customize::create($data);
            if($id > 0){
//                echo "成功";
                $this->request->redirect("/");
            }
//            var_dump($data);
//            exit;
        }

    }



}
